#!/bin/bash

prj="VesselOS:1.0:LTS:SP1"
repo="standard_x86_64"
arch="x86_64"
opts=

usage()
{
    echo "$0 [-p <project>] [-a <arch>] [-r <repository>] <package>"
    echo "-p: project, default: ${prj}"
    echo "-a: arch, default: ${arch}"
    echo "-r: repository, defualt: ${repo}"
}

if [ $# -lt 1 ]; then
    usage
    exit 1
fi

while getopts ":p:a:r:h" opt
do
    case $opt in
    h)
        usage
	;;
    p)
        prj=${OPTARG}
        ;;
    a)
        arch=${OPTARG}
        ;;
    r)
        repo=${OPTARG}
        ;;
    ?)
        echo "unknown option $OPTARG"
        ;;
    esac
done

shift $(($OPTIND - 1))

pkg=$1
set -x
osc rebuild ${prj} ${pkg} ${repo} ${arch}
